<head>
    <link href="${ctx}/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <link href="${ctx}/font-awesome/3.0.0/css/font-awesome.min.css" rel="stylesheet">
    <link href="${ctx}/css/index.css" rel="stylesheet">
    <link href="${ctx}/bootstrap-table/1.12.0/bootstrap-table.min.css" rel="stylesheet">
    <script src="${ctx}/jquery/2.1.4/jquery.min.js"></script>
    <script src="${ctx}/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="${ctx}/bootstrap-table/1.12.0/bootstrap-table.min.js"></script>
    <script src="${ctx}/bootstrap-table/1.12.0/locale/bootstrap-table-zh-CN.min.js"></script>
    <script src="${ctx}/bootstrap-table/1.12.0/extensions/export/bootstrap-table-export.min.js"></script>
    <script src="${ctx}/js/extends.js"></script>
    <script src="${ctx}/layui/layui.all.js"></script>
    <script src="${ctx}/js/util.js"></script>
    <link href="${ctx}/layui/css/layui.css" rel="stylesheet">
    <style>
        .lay-box {
            width: 100%;
            box-sizing: border-box;
            padding: 15px 12px;
        }

        .layui-form-checkbox[lay-skin=primary] i {
            top: 5px;
        }
        .form_box {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
        }
        .form_line {
            width: 180px;
        }
        .btn {
            width: 80px;
        }

        .show_box {
            width: 100%;
        }
        .layui-table-view {
            overflow: hidden!important;
        }

        .layui-table-cell {
            height: 54px!important;
            text-align: left;
        }
    </style>
</head>
<body>
<div class="lay-box">
    <form class="layui-form " action="">
        <div class="form_box">
            <div class="form_line">
                <select name="appStore" id="appStore" lay-verify="" >
                    <option value="all">全部渠道</option>
                    <#list appStoreList as list>
                    <option value="${list.code}">${list.name}</option>
                </#list>
                </select>
            </div>
        </div>
            <span class="btn layui-btn" style="margin-left: 25px" onclick="search()">查询</span>


    </form>

    <div class="show_box">
    <#-- 总完成情况统计 -->
        <table class="table table-border table-bordered table-hover table-bg table-sort" id="layTable" lay-filter="tableFilter">
        </table>

    <#-- 渠道完成情况统计 -->
        <table class="table table-border table-bordered table-hover table-bg table-sort" id="channelTable" lay-filter="tableFilter">
        </table>
    </div>

<script>
    var tableIns;
    var channelIns;
    var form;
    var startDate = "${star}";
    var endDate = "${end}";
    var appStore= "${appStore}";
    var table = "tb_download_member_record";
    layui.use('table', function () {
        tableIns = layui.table, form = layui.form;
        form.render();
        tableIns.render({
            elem: '#layTable',
            url: '/sys/cencesearnday/sumcount',
            method: 'POST',
            where: {
                'star': startDate,
                'end': endDate,
                appStore:appStore
            },
            toolbar:true,
            id: 'dataTableId',
            height:'300',
            page: true,
            cols: [[
                {
                    field: 'count',
                    title: '完成次数',
                    align: 'center',
                }, {
                    field: 'pkg_name',
                    title: '完成数',
                    align: 'center',
                    templet: function (data) {
                        return '<p>今日'+data.total+'' +
                                '<i class="layui-icon layui-icon-return" style="display: inline-block;margin-left: 5px;'+
                                (data.total>data.betweenTotal?'color:#2cfd2c;transform: rotate(90deg);':'color:red;transform:rotate(-90deg)')+ '">' +
                                '</i>' +
                                '</p>' +
                                '<p>昨日'+data.betweenTotal+'</p>';
                    }
                }
                , {
                    field: 'app_name',
                    title: '新用户',
                    align: 'center',
                    templet: function (data) {
                        return '<p>今日'+data.newTotal+'' +
                                '<i class="layui-icon layui-icon-return" style="display: inline-block;margin-left: 5px;'+
                                (data.newTotal>data.betweenNewTotal?'color:#2cfd2c;transform: rotate(90deg);':'color:red;transform:rotate(-90deg)')+ '">' +
                                '</i>' +
                                '</p>' +
                                '<p>昨日'+data.betweenNewTotal+'</p>';
                    }
                }, {
                    field: 'app_name',
                    title: '老用户',
                    align: 'center',
                    templet: function (data) {
                        return '<p>今日'+data.oldTotal+'' +
                                '<i class="layui-icon layui-icon-return" style="display: inline-block;margin-left: 5px;'+
                                (data.newTotal>data.betweenNewTotal?'color:#2cfd2c;transform: rotate(90deg);':'color:red;transform:rotate(-90deg)')+ '">' +
                                '</i>' +
                                '</p>' +
                                '<p>昨日'+data.betweenOldTotal+'</p>';
                    }
                }
            ]],
        })


        tableIns.render({
            elem: '#channelTable',
            url: '/sys/cencesearnday/sumcountv2',
            method: 'POST',
            where: {
                'star': startDate,
                'end': endDate,
                appStore:appStore
            },
            id: 'channelId',
            height:'300',
            page: true,
            cols: [[
                {
                    field: 'sdkName',
                    title: '渠道',
                    align: 'center',
                }, {
                    field: 'finish_num',
                    title: '完成数',
                    align: 'center',
                    sort:true,
                    templet: function (data) {
                        return '<p>今日'+data.successTotal+'' +
                                '<i class="layui-icon layui-icon-return" style="display: inline-block;margin-left: 5px;'+
                                (data.successTotal>data.over_successTotal?'color:#2cfd2c;transform: rotate(90deg);':'color:red;transform:rotate(-90deg)')+ '">' +
                                '</i>' +
                                '</p>' +
                                '<p>昨日'+data.over_successTotal+'</p>';
                    }
                }
                , {
                    field: 'task_num',
                    title: '任务数',
                    align: 'center',
                    sort: true,
                    templet: function (data) {
                        return '<p>今日'+data.allTotal+'' +
                                '<i class="layui-icon layui-icon-return" style="display: inline-block;margin-left: 5px;'+
                                (data.allTotal>data.over_allTotal?'color:#2cfd2c;transform: rotate(90deg);':'color:red;transform:rotate(-90deg)')+ '">' +
                                '</i>' +
                                '</p>' +
                                '<p>昨日'+data.over_allTotal+'</p>';
                    }
                }, {
                    field: 'pay',
                    title: '支出',
                    align: 'center',
                    sort: true,
                    templet: function (data) {
                        return '<p>今日'+data.money+'' +
                                '<i class="layui-icon layui-icon-return" style="display: inline-block;margin-left: 5px;'+
                                (data.money>data.over_money?'color:#2cfd2c;transform: rotate(90deg);':'color:red;transform:rotate(-90deg)')+ '">' +
                                '</i>' +
                                '</p>' +
                                '<p>昨日'+data.over_money+'</p>';
                    }
                }, {
                    field: 'app_name',
                    title: '新用户/老用户',
                    align: 'center',
                    sort: true,
                    templet: function (data) {
                        return '<p>今日'+data.oldTotal+'' +
                                '<i class="layui-icon layui-icon-return" style="display: inline-block;margin-left: 5px;'+
                                (data.newTotal>data.oldTotal?'color:#2cfd2c;transform: rotate(90deg);':'color:red;transform:rotate(-90deg)')+ '">' +
                                '</i>' +
                                '</p>' +
                                '<p>昨日'+data.oldTotal+'</p>';
                    }
                }, {
                    field: 'app_name',
                    title: '新用户完成',
                    align: 'center',
                    sort: true,
                    templet: function (data) {
                        return '<p>今日'+data.newTotal+'' +
                                '<i class="layui-icon layui-icon-return" style="display: inline-block;margin-left: 5px;'+
                                (data.newTotal>data.over_newTotal?'color:#2cfd2c;transform: rotate(90deg);':'color:red;transform:rotate(-90deg)')+ '">' +
                                '</i>' +
                                '</p>' +
                                '<p>昨日'+data.over_newTotal+'</p>';
                    }
                }, {
                    field: 'app_name',
                    title: '老用户完成数',
                    align: 'center',
                    sort: true,
                    templet: function (data) {
                        return '<p>今日'+data.oldTotal+'' +
                                '<i class="layui-icon layui-icon-return" style="display: inline-block;margin-left: 5px;'+
                                (data.oldTotal>data.over_oldTotal?'color:#2cfd2c;transform: rotate(90deg);':'color:red;transform:rotate(-90deg)')+ '">' +
                                '</i>' +
                                '</p>' +
                                '<p>昨日'+data.over_oldTotal+'</p>';
                    }
                }
            ]]
        })
    });


    function search() {
        var appStore = $("#appStore").val();
        tableIns.reload('dataTableId', {
            where: {star: star, end: end, appStore: appStore},
            page: {
                curr: 1
            }
        });
        channelIns.reload('channelId', {
            where: {star: star, end: end, appStore: appStore},
            page: {
                curr: 1
            }
        });
    }

</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>